Auth()
//首页数据展示
//轮播图
$.ajax({
	type: "post",
	url: apicom + "/consultation/welcomeConsultation",
	data:{type:5},
	async: true,
	success: function(res) {
		console.log(res.data)
		var lunbo = res.data;
		var ss = ''
		for(var i = 0; i < lunbo.length; i++){
			ss+='<div class="swiper-slide"><a href="#"><img src="'+lunbo[i].address+'" /></a><p class="s_tittle">'+lunbo[i].title+'</p></div>'
		};
		$('.swiper-wrapper').html(ss);	
		var mySwiper = new Swiper('.swiper-container', {
			direction: 'horizontal', // 垂直切换选项
			autoplay: true,
			grabCursor: true,
			loop: true, // 循环模式选项

			// 如果需要分页器
			pagination: {
				el: '.swiper-pagination',
				clickable: true,
			},
		})
	},
	error: function(err) {

	}
});
//热点资讯
$.ajax({
	type: "post",
	url: apicom + "/consultation/welcomeConsultation",
	data:{type:1},
	async: true,
	success: function(res) {
		console.log(res.data)
		var hot = res.data;
		if(hot.length>8){
			hot.length = 8;
		}
		var ss = ''
		for(var i = 0; i < hot.length; i++){
			ss+='<p data-id="'+hot[i].id+'" class="hot_p"><span class="dian">·</span><span class="hot_detail">'+hot[i].title+'</span><span class="hot_name">'+hot[i].memberName+'</span></p>'
		};
		$('.r_main').html(ss);	
	},
	error: function(err) {

	}
});
//政策文件
$.ajax({
	type: "post",
	url: apicom + "/consultation/welcomeConsultation",
	data:{type:2},
	async: true,
	success: function(res) {
		console.log(res.data)
		var zhengce = res.data;
		var ss = ''
		if(zhengce.length>8){
			zhengce.length = 8;
		}
		for(var i = 0; i < zhengce.length; i++){
			ss+='<p data-id="'+zhengce[i].id+'" class="hot_p"><span class="dian">·</span><span class="hot_detail">'+zhengce[i].title+'</span></p>'
		};
		$('.z_main').html(ss);	
	},
	error: function(err) {

	}
});
//优秀志愿者
$.ajax({
	type: "post",
	url: apicom + "/consultation/welcomeConsultation",
	data:{type:3},
	async: true,
	success: function(res) {
		console.log(res.data)
		var vlbest = res.data;
		var ss = ''
		if(vlbest.length>2){
			vlbest.length = 2
		}
		for(var i = 0; i < vlbest.length; i++){
			ss+='<div data-id="'+vlbest[i].id+'" class="best_vlxq"><img class="xq_img" src="'+vlbest[i].address+'" /><dl class="xq_dl"><dt><span class="dian">·</span><span class="hot_detail">'+vlbest[i].title+'</span></dt><dd class="zhengwen">'+vlbest[i].desc+'</dd></dl></div>'
		};
		$('.best_vl').html(ss);
	},
	error: function(err) {

	}
});
//优秀志愿者团队
$.ajax({
	type: "post",
	url: apicom + "/consultation/welcomeConsultation",
	data:{type:4},
	async: true,
	success: function(res) {
		console.log(res.data)
		var teambest = res.data;
		var ss = ''
		if(teambest.length>2){
			teambest.length = 2
		}
		for(var i = 0; i < teambest.length; i++){
			ss+='<div data-id="'+teambest[i].id+'" class="best_vlxq"><dl class="xq_dl1"><dt><span class="dian">·</span><span class="hot_detail">'+teambest[i].title+'</span></dt><dd class="zhengwen">'+teambest[i].desc+'</dd></dl></div>'
		};
		$('.best_team').html(ss);
	},
	error: function(err) {

	}
});
//切换团队和志愿者
$('#zyz').on('click',function(){
	$('#zyz').addClass('is_team');
	$('#zyz_team').removeClass('is_team');
	$('.best_vl').show();
	$('.best_team').hide();
})
$('#zyz_team').on('click',function(){
	$('#zyz_team').addClass('is_team');
	$('#zyz').removeClass('is_team');
	$('.best_vl').hide();
	$('.best_team').show();
})
//跳转更多优秀志愿者和团体页面
$('#more').on('click',function(){
	console.log(111)
	if($('#zyz').hasClass('is_team')){
		window.location.href = 'best_volunteer.html?type=3'
	}
	if($('#zyz_team').hasClass('is_team')){
		window.location.href = 'best_volunteer.html?type=4'
	}
})
//点击跳转资讯详情页
$(document).on('click','.hot_p',function(){
	var zxId = $(this).attr('data-id');
	window.location.href = 'msg_detail.html?zxId='+zxId;
})
$(document).on('click','.best_vlxq',function(){
	var zxId = $(this).attr('data-id');
	window.location.href = 'msg_detail.html?zxId='+zxId;
})